<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery.min.js"></script>
</head>
<body>
<h1>人数：<span id="count"></span></h1>
<form  action="login" method="post">
    <input type="text" name="usr" id="usr"/>
    <input type="password" name="pwd" id="pwd"/>
    <input type="submit" value="登录" id="d1"/>
</form>
<script>
    var cookie=document.cookie;
    var cks=cookie.split(";");//把字符串分割成几个段，然后遍历整个数组。
    var user=document.getElementById("usr");
    var pwd=document.getElementById("pwd");
    for (var i=0;i<cks.length;i++){
        var kv=cks[i].split("=");
        if (kv[0].trim()=="usr")user.value=kv[1];
        if (kv[0].trim()=="password") pwd.value=kv[1];
    }
    //    if (user.value!=""&&pwd.value!=""){
    //        document.getElementById("d1").click();
    //    }//自动登录
    $.get("persons",function (data) {//链接persons页面，获取访问人数
        $("#count").html(data.p);
    })

</script>
</body>
</html>